@echo off
:: 设置命令行编码为GBK，解决中文显示乱码问题
chcp 936 >nul 2>&1
setlocal enabledelayedexpansion

:: 设置Nacos目录
set "NACOS_BIN_DIR=E:\software\nacos-server-2.2.2\nacos\bin"
set "NACOS_STARTUP=!NACOS_BIN_DIR!\startup.cmd"

:: 创建临时VBScript用于隐藏启动Nacos
set "VBS_FILE=%temp%\start_nacos_temp.vbs"
echo Set objShell = CreateObject("WScript.Shell") > "!VBS_FILE!"
echo objShell.Run "cmd /c ""!NACOS_STARTUP!"" -m standalone", 0, False >> "!VBS_FILE!"

:: 执行VBScript隐藏启动Nacos
echo 正在启动Nacos服务（隐藏窗口模式）...
cscript //nologo "!VBS_FILE!"
del /f /q "!VBS_FILE!" >nul 2>&1

:: 等待Nacos启动完成（可根据实际情况调整等待时间）
echo 等待Nacos启动完成...
timeout /t 10 /nobreak >nul
echo Nacos已在后台隐藏启动

echo Nacos控制台地址: http://localhost:8848/nacos
pause >nul
